{% extends "base.html" %}
{% load add_field_css i18n %}

{% block head-title %}<span class="emoji">🏆</span>{% trans "Create New Tournament"%}{% endblock %}
{% block page-title %}{% trans "Tabbycat" %}{% endblock %}
{% block sidebar %}{% endblock %} {# Need to override sidebar manually it will crash when no tournaments are present. Ideally this would be handled with the Mixins but this is a relatively unique view as it is part of Tournaments but is admin-only and thus shown with the sidebar #}

{% block page-alerts %}
  {% include 'errors/database_limit_warning.html' %}
{% endblock %}

{% block content %}

  {% url 'donations' as donations_url %}
  {% blocktrans trimmed asvar donation %}
    Tabbycat is free to use for non-profit and non-fundraising tournaments
    (although donations are encouraged). If your tournament is run for profit
    or for fundraising, please note that there is a
    <a href="{{ donations_url }}">required payment</a>. For more details, see the <a href="http://tabbycat.readthedocs.io/en/stable/about/licence.html">
    Tabbycat licence agreement</a>.
  {% endblocktrans %}
  {% include "components/explainer-card.html" with type="primary" p1=donation %}

  <div class="card border-info text-info mt-3">
    <div class="card-body">

      <strong>{% trans "Just trying out Tabbycat?" %}</strong>
      {% blocktrans trimmed %}
        If you're learning or playing around with Tabbycat, it's easiest to
        create a demo tournament that is prepopulated with a fake (but typical)
        set of teams, adjudicators, rooms, and the like. You can then delete
        this demo tournament later on, or deploy a new instance for your real
        tournament.
      {% endblocktrans %}

      <div class="row mt-3">
        {% for slug, demo in demo_datasets %}
          <div class="col col-md-4">
            <form action="{% url 'load-demo' %}" method="POST">
              <input type="hidden" name="source" value="{{ slug }}">
              <button type="submit" class="btn btn-info btn-block">
                {% blocktrans trimmed %}
                  Load {{ demo }}
                {% endblocktrans %}
              </button>
            </form>
            {% if slug in preexisting %}
              <div class="alert alert-warning mt-3 mb-0 small">
                {% blocktrans trimmed %}
                  You already have a tournament set up using this data set. Reloading
                  the data will delete <strong>all data</strong> from that tournament.
                {% endblocktrans %}
              </div>
            {% endif %}
          </div>
        {% endfor %}
      </div>

    </div>
  </div>

  <div class="card mt-3">
    <div class="list-group list-group-flush">
    <form action="." method="POST">
      {% csrf_token %}

      {% include "components/form-main.html" %}

      {% trans "Create Tournament" as title %}
      {% trans "Cancel and go back to the site home page" as subtitle %}
      {% url 'tabbycat-index' as suburl %}
      {% include "components/form-submit.html" %}

    </form>
    </div>
  </div>

{% endblock %}
